Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][DO NOT MERGE] Remove LiteralTypeForLiteral by creating IsInstance function #5909

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mecoli1219
Copy link

@Mecoli1219 Mecoli1219 commented Oct 24, 2024

Tracking issue

#5908

Why are the changes needed?

The current Tuple IDL design is complicated by this function since if we want to guess the LiteralType from Literal, we have to store the name of the tuple and the name of each field inside the tuple in the Literal.

However, guessing the LiteralType is not necessary for Flyte since whenever we create a new literal, there must be a target type (maybe inputs or outputs, but they will always have a defined type). Also, almost all use cases of LiteralTypeForLiteral are followed by a function AreTypesCastable, we could simply combine these two functions into a function determining whether a Literal could be instantiated by a LiteralType. It is really similar to isinstance() function in Python.

What changes were proposed in this pull request?

  • I created an IsInstance() for the flytepropeller to check whether a Literal could be represented by a LiteralType.
  • Remove LiteralTypeForLiteral and update all necessary code in FlyteAdmin & FlytePropeller.
  • Update the unit tests
    • Change unit tests for LiteralTypeForLiteral to IsInstance
    • Update the error message for other cases.

How was this patch tested?

  • Unit testing
  • Built and run some Flytekit test

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Additional Concerns

Someone suggested that we shouldn't merge this PR before the release

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 39.78495% with 112 lines in your changes missing coverage. Please review.

Project coverage is 36.75%. Comparing base (6c4f8db) to head (af0ea73).
Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
flytepropeller/pkg/compiler/validators/utils.go 32.05% 98 Missing and 8 partials ⚠️
...tepropeller/pkg/compiler/errors/compiler_errors.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5909      +/-   ##
==========================================
+ Coverage   36.49%   36.75%   +0.26%     
==========================================
  Files        1296     1309      +13     
  Lines      109571   130941   +21370     
==========================================
+ Hits        39988    48130    +8142     
- Misses      65426    78624   +13198     
- Partials     4157     4187      +30     
Flag Coverage Δ
unittests-datacatalog 51.58% <ø> (+0.21%) ⬆️
unittests-flyteadmin 53.99% <100.00%> (-1.58%) ⬇️
unittests-flytecopilot 11.73% <ø> (?)
unittests-flytectl 62.40% <ø> (+0.14%) ⬆️
unittests-flyteidl 6.92% <ø> (-0.22%) ⬇️
unittests-flyteplugins 53.57% <ø> (+0.10%) ⬆️
unittests-flytepropeller 42.79% <37.07%> (+0.75%) ⬆️
unittests-flytestdlib 55.41% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Future-Outlier Future-Outlier changed the title [DO NOT MERGE] Remove LiteralTypeForLiteral by creating IsInstance function [WIP][DO NOT MERGE] Remove LiteralTypeForLiteral by creating IsInstance function Oct 24, 2024
Copy link
Member

@Future-Outlier Future-Outlier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you test every test case be affected in flytekit remote?
and provide screenshot?
I think this function is not well tested by unit test and integration test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants